/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fr.cggveritas.crewintranet.jms.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Alassane
 */
@Entity
@Table(name = "cv_travailprime")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CvTravailprime.findAll", query = "SELECT c FROM CvTravailprime c"),
    @NamedQuery(name = "CvTravailprime.findByTravailleurId", query = "SELECT c FROM CvTravailprime c WHERE c.cvTravailprimePK.travailleurId = :travailleurId"),
    @NamedQuery(name = "CvTravailprime.findByTypeprime", query = "SELECT c FROM CvTravailprime c WHERE c.cvTravailprimePK.typeprime = :typeprime"),
    @NamedQuery(name = "CvTravailprime.findByDateprime", query = "SELECT c FROM CvTravailprime c WHERE c.dateprime = :dateprime"),
    @NamedQuery(name = "CvTravailprime.findByPrime", query = "SELECT c FROM CvTravailprime c WHERE c.prime = :prime"),
    @NamedQuery(name = "CvTravailprime.findByMontantprime", query = "SELECT c FROM CvTravailprime c WHERE c.montantprime = :montantprime")})
public class CvTravailprime implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CvTravailprimePK cvTravailprimePK;
    @Basic(optional = false)
    @Column(name = "dateprime")
    @Temporal(TemporalType.DATE)
    private Date dateprime;
    @Column(name = "prime")
    private String prime;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "montantprime")
    private BigDecimal montantprime;
    @JoinColumn(name = "typeprime", referencedColumnName = "typeprime", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CvTypeprime cvTypeprime;
    @JoinColumn(name = "travailleur_id", referencedColumnName = "cv_travailleur_id", insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private CvTravail cvTravail;

    public CvTravailprime() {
    }

    public CvTravailprime(CvTravailprimePK cvTravailprimePK) {
        this.cvTravailprimePK = cvTravailprimePK;
    }

    public CvTravailprime(CvTravailprimePK cvTravailprimePK, Date dateprime) {
        this.cvTravailprimePK = cvTravailprimePK;
        this.dateprime = dateprime;
    }

    public CvTravailprime(int travailleurId, String typeprime) {
        this.cvTravailprimePK = new CvTravailprimePK(travailleurId, typeprime);
    }

    public CvTravailprimePK getCvTravailprimePK() {
        return cvTravailprimePK;
    }

    public void setCvTravailprimePK(CvTravailprimePK cvTravailprimePK) {
        this.cvTravailprimePK = cvTravailprimePK;
    }

    public Date getDateprime() {
        return dateprime;
    }

    public void setDateprime(Date dateprime) {
        this.dateprime = dateprime;
    }

    public String getPrime() {
        return prime;
    }

    public void setPrime(String prime) {
        this.prime = prime;
    }

    public BigDecimal getMontantprime() {
        return montantprime;
    }

    public void setMontantprime(BigDecimal montantprime) {
        this.montantprime = montantprime;
    }

    public CvTypeprime getCvTypeprime() {
        return cvTypeprime;
    }

    public void setCvTypeprime(CvTypeprime cvTypeprime) {
        this.cvTypeprime = cvTypeprime;
    }

    public CvTravail getCvTravail() {
        return cvTravail;
    }

    public void setCvTravail(CvTravail cvTravail) {
        this.cvTravail = cvTravail;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (cvTravailprimePK != null ? cvTravailprimePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CvTravailprime)) {
            return false;
        }
        CvTravailprime other = (CvTravailprime) object;
        if ((this.cvTravailprimePK == null && other.cvTravailprimePK != null) || (this.cvTravailprimePK != null && !this.cvTravailprimePK.equals(other.cvTravailprimePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.cggveritas.crewintranet.jms.entities.CvTravailprime[ cvTravailprimePK=" + cvTravailprimePK + " ]";
    }
    
}
